package net.begincode.blog;

import net.begincode.auth.UserInfo;
/**
 * 登录用户上下文
 * */
public class UserContext {

    private static final ThreadLocal<UserInfo> userInfoLocal = new ThreadLocal<>();

    public UserContext() {
    }

    public static UserInfo getUserInfo() {
        return userInfoLocal.get();
    }

    public static void setUserInfo(UserInfo userInfo) {
        userInfoLocal.set(userInfo);
    }

    public static void release() {
        userInfoLocal.remove();
    }
}
